package com.example.demo.config;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author Liunh
 */
@Data
@Component
public class AppProperties {

    @Value(value = "${spring.application.name}")
    private String appName;
    @Value(value = "${server.node}")
    private String appNode;
    @Value(value = "${server.port}")
    private Integer port;
    @Value(value = "${server.servlet.context-path:/}")
    private String contextPath;

    @Value(value = "${spring.http.multipart.defaultEncoding:UTF-8}")
    private String defaultEncoding;
    @Value(value = "${spring.http.multipart.maxFileSize:2GB}")
    private String maxFileSize;
    @Value(value = "${spring.http.multipart.maxRequestSize:1GB}")
    private String maxRequestSize;

    // --------------------------- 数据库配置 ----------------------------

    @Value(value = "${spring.session.jdbc.platform:DM}")
    private String dbPlatform;
    @Value(value = "${spring.jpa.properties.hibernate.default_schema:SYSDBA}")
    private String dbSchema;

    @Value("${spring.datasource.type:com.zaxxer.hikari.HikariDataSource}")
    public String type;
    @Value("${spring.datasource.driverClassName}")
    public String driver;
    @Value("${spring.datasource.url}")
    public String url;
    @Value("${spring.datasource.username:test}")
    public String username;
    @Value("${spring.datasource.password:123456}")
    public String password;

    @Value("${spring.datasource.hikari.auto-commit:false}")
    public boolean autoCommit;
    @Value("${spring.datasource.hikari.minimum-idle:10}")
    public int minimumIdle;
    @Value("${spring.datasource.hikari.idle-timeout:200000}")
    public int idleTimeout;
    @Value("${spring.datasource.hikari.connection-timeout:180000}")
    public int connectionTimeout;
    @Value("${spring.datasource.hikari.max-lifetime:300000}")
    public int maxLifetime;
    @Value("${spring.datasource.hikari.maximum-pool-size:128}")
    public int maximumPoolSize;
}
